/*
 * Use or Copy is free, but retain author declaration.
 */
package pyip.lib.mixtool.simplehttpclient;

/**
 * @author yepeng
 * @date 2015年3月9日
 */
public class RequestConfig implements Cloneable {
    // 毫秒
    private int connectTimeout;
    // 毫秒
    private int readTimeout;
    // 请求参数的编码
    private String requestCharset;
    // 响应内容的编码
    // 优先使用request#getConfig()#getResponseCharset(), 其次response header contentType charset, 最后spider#getConfig()#getResponseCharset()
    private String responseCharset;

    public int getConnectTimeout() {
        return connectTimeout;
    }

    public void setConnectTimeout(int connectTimeout) {
        this.connectTimeout = connectTimeout;
    }

    public int getReadTimeout() {
        return readTimeout;
    }

    public void setReadTimeout(int readTimeout) {
        this.readTimeout = readTimeout;
    }

    public String getRequestCharset() {
        return requestCharset;
    }

    public void setRequestCharset(String requestCharset) {
        this.requestCharset = requestCharset;
    }

    public String getResponseCharset() {
        return responseCharset;
    }

    public void setResponseCharset(String esponseCharset) {
        this.responseCharset = esponseCharset;
    }

    @Override
    public RequestConfig clone() {
        RequestConfig config = null;
        try {
            config = (RequestConfig) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
            // Won't happen
        }
        return config;
    }

}
